package download;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Observable;
import java.util.Observer;

public class DownloadMain {

	private Download download;

	public static void main(String[] args) throws Throwable {

		new DownloadMain().run();
	}

	private void run() throws Throwable {
		download = new Download(new URL(
				"http://www.allocine.fr"));
		download.addObserver(new Observer() {

			@Override
			public void update(Observable obs, Object obj) {
				if (download.getStatus() != Download.COMPLETE) {
					return;
				}
				
				File file = download.getFile();
//				String line = null;
//				
//				try {
//					while ((line = file.readLine()) != null) {
//						System.out.println(line);
//					}
//				} catch (IOException e) {
//					e.printStackTrace();
//				}

			}
		});
	}
}
